<?php
require_once("../resources/commons.php");
require_once("../data/User.php");
require_once("../data/Activity.php");
require_once("../data/Item.php");
require_once("admin_commons.php");
checkAdminRights();
header('Content-type: text/xml; charset=iso-8859-1');

$l_activity=Activity::getFromPrimaryKey(base64_decode($_REQUEST[ZOOMAREA_ID_PARAMETER]));
$l_closeFunction=$_REQUEST[ZOOMAREA_CLOSEFUNC_PARAMETER];

?>
<p><b>In charge: </b>
<?

$l_responsibleUser=$l_activity->getResponsibleUser_Id_Ref();
if(isset($l_responsibleUser)){
	echo $l_responsibleUser->getFullName();
}else{
	echo "Not yet allocated";
}

?>
</p>
<b>Description:</b>
<div style="border:1px solid;"><?=$l_activity->getDescription() ?></div>
<br/>
<?php

	if($l_activity->getIsArchived()){
		
?>
<p><b>WARNING: The activity is archived.</b></p>
<?php

	}
?>
<?php
	
$l_openedActions=Item::getFromCustomCriteria("WHERE Activity_Id=:Activity_Id AND ItemType_id=:ItemType_id AND ItemStatus_id=:ItemStatus_id",
array(
	"Activity_Id" => $l_activity->getId(),
	"ItemType_id" => Item::ACTION_TYPE,
 	"ItemStatus_id" => Item::ACTION_STATUS_OPENED));

?>
There are <b><?=count($l_openedActions) ?> opened actions</b> for this activity.
<ul>
<?php
if(count($l_openedActions) !=0){
	foreach($l_openedActions as $l_openedAction){
		?>
		<li><b><?=$l_openedAction->getTitle() ?></b> created by <b><?=$l_openedAction->getCreatingUser_id_Ref()->getFullName() ?></b></li>
		<?php
	}
}
?>
</ul>
<center><a href="#" onclick="return <?=$l_closeFunction ?>('<?=$_REQUEST[ZOOMAREA_ID_PARAMETER] ?>');"><img border="0" src="../resources/images/close.png"/></a></center>